﻿using System;
using System.Web.Caching;

namespace PruebasCesar.Models
{
    public class GeneralCache
    {
        private readonly Cache _cache;

        public GeneralCache()
        {
            _cache = new Cache();
        }

        public void Insert<T>(string key, T obj, Func<T> callback)
        {
            _cache.Insert(key, obj, null, DateTime.Now.AddMinutes(10), TimeSpan.Zero);
        }

        public T Get<T>(string key)
        {
            return (T) _cache.Get(key);
        }
    }
}